<template>
        <div class="GrandChild">
                <h3>孙子组件</h3>
                <h4>银子：{{ money }}</h4>
                <h4>车子：一辆{{ car.brand }}, 价值{{car.price }}万元</h4>
                <button @click="updateMoney(6)">花爷爷的钱</button>
        </div>
</template>
<script setup lang="ts">
import { inject } from 'vue';

let {money,updateMoney} = inject('moneyContext',{money:0,updateMoney:(_x:number)=>{}})
let car = inject('car',{brand:'未知',price:'0'})
</script>
<style scoped>
.GrandChild {
        background-color: rgb(62, 142, 222);
        padding: 10px;
        box-shadow: 0 0 10px black;
        border-radius: 10px;
        margin-top: 20px;
}
</style>